import { Component ,Input,ElementRef,Renderer2,ViewChild} from '@angular/core';
import {  NavController, NavParams } from 'ionic-angular';
import {TopicInfo} from "../../models/quesinfo";

/**
 * Generated class for the QuestionTestCompletionPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */


@Component({
  selector: 'page-question-test-completion',
  templateUrl: 'question-test-completion.html',
})
export class QuestionTestCompletionPage {
  @Input() topic: TopicInfo;@Input() poneSet: Array<any>;
  @Input() topicIndex;
  topicIndexshow;

  @ViewChild('tk1') tk1: ElementRef;
  constructor(public navCtrl: NavController, public navParams: NavParams,private elementRef: ElementRef,public renderer2:Renderer2 ) {
  }

  ionViewDidLoad() {
    //console.log('ionViewDidLoad QuestionTestCompletionPage');
  }

  ngOnInit(): void {

 this.topicIndexshow=this.topicIndex+1;


    let pEle = this.elementRef.nativeElement.querySelector('.completion');



    //Called after the constructor, initializing input properties, and the first call to ngOnChanges.
    //Add 'implements OnInit' to the class.

    pEle.innerHTML = this.topic.FTitle;
    let el = this.tk1.nativeElement;

    for(var i = 0;i<el.children.length;i++){
      this.renderer2.removeAttribute(el.children[i], 'readonly');
    }
    this.topic.testCompletion = pEle;

    // //console.log(this.topic["testCompletion"])


  }

}
